const { Router } = require('express')
const {
  addTag,
  pageTag,
  getTag,
  deleteTag,
  updateTag,
  getAllTags,
} = require('../controllers/tagController')
const interceptor = require('../middlewares/interceptor')
const restrictTo = require('../middlewares/restrictTo')

const router = Router()

router.post('/tag', interceptor, restrictTo(['admin']), addTag)
router.get('/tag', pageTag)
router.get('/tag/all', getAllTags)
router.get('/tag/:id', getTag)
router.delete('/tag/:id', interceptor, restrictTo(['admin']), deleteTag)
router.put('/tag/:id', interceptor, restrictTo(['admin']), updateTag)

module.exports = router
